/**
 * Created by shaotingzhou on 2017/5/9.
 */
// 统计一级页面的中间部分
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    TouchableOpacity,
    ListView,
    Navigator,
    Platform,
    InteractionManager
} from 'react-native';

var NavigatorBar = require('../Main/NXNavigationBar') //NavigationBar
var textIncome = {
  "data": [
    {
      "type":1,
      "time":"10月19日 20:14",
      "title": "歌曲:千里之外",
      "origin": "1000",
      "number": "1000",
      "year":"2000",
      "price":"4000",
      "song":"歌手:周杰伦,费玉清"
    },{
      "type":1,
      "time":"10月19日 20:14",
      "title": "歌曲:十年",
      "origin": "1000",
      "number": "1000",
      "year":"2000",
      "price":"4000",
      "song":"歌手:陈奕迅"
    },{
      "type":1,
      "time":"10月19日 20:14",
      "title": "歌曲:祝福",
      "origin": "1000",
      "number": "1000",
      "year":"2000",
      "price":"4000",
      "song":"歌手:张学友"
    },{
      "type":1,
      "time":"10月19日 20:14",
      "title": "歌曲:红豆",
      "origin": "1000",
      "number": "1000",
      "year":"2000",
      "price":"4000",
      "song":"歌手:王菲"
    },
  ]
}





export default class IncomePush extends Component {

constructor(props) {
         super(props);
         var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
         this.state = {
             dataSource: ds.cloneWithRows(textIncome.data),
             isCollect:true,
         };
     }
leftAction(){
    InteractionManager.runAfterInteractions(() => {
            this.props.navigator.pop({

            });
           }); 

}
    render() {
        return (
            <View style = {{backgroundColor:'#C4C4C4',}}>
                <NavigatorBar title='收入统计' widthWH={Platform.OS == 'ios' ? 15 : 15} leftBtnName='back' rightBtnName='Share_icon' leftpress={() => this.leftAction()} rightPress={() => this.rightAction()} />
                <ListView
                 dataSource={this.state.dataSource}
                 renderRow={this._renderRow}
                 />
            </View>
        );
    }
    _renderRow(rowData){
         return(
             <View style={styles.container}>
                 <View style={styles.timeViewStyle}>
                     <Text style={styles.timeStyle}>{rowData.time}</Text>
                 </View>



                 <View style={styles.contentStyle}>


                         <Text style={styles.titleStyle}>{rowData.title}</Text>


                     <View style={styles.detailsStyle}>
                        {/*--产区--*/}
                        <View style={styles.regionStyle}>
                            <Text style={styles.valueStyle}>{rowData.origin}</Text>
                            <Text style={styles.nameStyle}>复制权</Text>
                        </View>

                         <View style={styles.divide}/>

                        {/*--数量--*/}
                        <View style={styles.numberStyle}>
                            <Text style={styles.valueStyle}>{rowData.number}</Text>
                            <Text style={styles.nameStyle}>表演权</Text>
                        </View>

                         <View style={styles.divide}/>

                        {/*--年份--*/}
                        <View style={styles.yearStyle}>
                            <Text style={styles.valueStyle}>{rowData.year}</Text>
                            <Text style={styles.nameStyle}>网络传播权</Text>
                        </View>

                         <View style={styles.divide}/>

                        {/*--价格--*/}
                        <View style={styles.priceStyle}>
                            {/*<Text style={styles.pricevalueStyle}>{rowData.price}</Text>*/}
                            <Text style={styles.valueStyle}>{rowData.year}</Text>
                            <Text style={styles.nameStyle}>总金额</Text>
                        </View>
                     </View>

                     <View style={styles.line}/>

                     <View style={styles.questionStyle}>
                        <Text style={styles.questionTestStyle}questionTestStyle>{rowData.song}</Text>
                         <Image style={styles.arrow} source={{uri:'forward'}}/>
                     </View>
                 </View>
             </View>

         );
     }

    itemOnclick = () => {
        // alert(this.props.topTxt)
        this.props.mynavigator.push({
            component: Songs
        })
    }

}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#f5f5f5',
        
    },
    songFix : {
        flexDirection: 'row',
        backgroundColor: 'white',
        height:60,
        marginLeft:20,
        marginRight:20,
    },
    timeViewStyle: {
        justifyContent: 'center',
        alignItems: 'center',
        height:45
    },timeStyle:{
        width:100,
        height:25,
        backgroundColor:'#999999',
        color:'#fff',
        borderRadius:3,
        fontSize:12,
        textAlign:'center',
        paddingTop:5
    },contentStyle:{
        borderWidth:1,
        height:145,
        borderColor:'#e5e5e5',
        backgroundColor:'#fff',
        marginLeft:10,
        marginRight:10,
        borderRadius:5,
    },detailsStyle:{
        flexDirection:'row',
        justifyContent: 'center',
        alignItems: 'center',
        height:55,
    },titleStyle:{
        marginTop:18,
        marginLeft:10,
        fontSize:15,
        fontWeight:'bold',
        color:'#333333'
    },regionStyle:{
        justifyContent: 'center',
        alignItems: 'center',
        width:75,
    },numberStyle:{
        justifyContent: 'center',
        alignItems: 'center',
        width:75,
    },yearStyle:{
        justifyContent: 'center',
        alignItems: 'center',
        width:75,
    },priceStyle:{
        justifyContent: 'center',
        alignItems: 'center',
        flex:1,
    },valueStyle:{
        fontSize:14,
        color:'#666666'
    },nameStyle:{
        fontSize:12,
        color:'#999999',
        marginTop:3
    },pricevalueStyle:{
        fontSize:16,
        color:'#8B0000'
    },divide:{
        width:0.5,
        height:40,
        backgroundColor:'#e5e5e5'
    },line:{
        height:0.5,
        backgroundColor:'#e5e5e5',
        marginLeft:5,
        marginRight:5
    },questionStyle:{
        justifyContent:'space-between',
       alignItems:'center',
        flex:1,
        marginLeft:10,
        marginRight:5,
        flexDirection:'row',
    },imageStyle:{
        width:15,
        height:15,
        justifyContent: 'center',
        alignItems: 'center',
    },questionTestStyle:{
        color:'#333333',
        fontSize:16
    },arrow:{
        width:10,
        height:15,
    },nullImageStyle:{
        width:100,
        height:100,
        marginTop:120
    },nullTextStyle:{
        fontSize:15,
        color:'#666666',
        marginTop:45
    },nullcontentStyles:{
        flex: 1,
        backgroundColor: '#F5F5F5',
        alignItems:'center'
    }
});